Clarify sink behaviour in implicit subscription model - #680
Conversation
|
Additional test case in sample-implicit-events-template.feature can be considered to check the error response when event delivery is not supported. |
Thanks @rartych! Good point |
Co-authored-by: Rafal Artych <121048129+rartych@users.noreply.github.com>
…uide.md Co-authored-by: Rafal Artych <121048129+rartych@users.noreply.github.com>
bigludo7
left a comment
There was a problem hiding this comment.
LGTM
Thanks @PedroDiez for the reminder
There was a problem hiding this comment.
See a few suggestions below.
Two small things in the PR description, since it feeds the release notes:
- The Changes list doesn't mention the added test scenario in
artifacts/testing/sample-implicit-events-template.feature. - "providing an unsupported sink returns an error" (in the
CreateResource.sinkbullet) sounds like the existing400 INVALID_SINK/INVALID_PROTOCOL/INVALID_CREDENTIALcases, which this PR doesn't change. The new code is for a different case: the provider doesn't support notification delivery at all.
On the breaking change I agree, and I think the PR should say who has to act on it. Today an implementation may accept sink, create the resource, and simply not send events; nothing forbids it. After this PR that is no longer allowed. Whether to document the new 422 is then each API's own decision: an API that wants to allow implementations without notification delivery adds it — a breaking change per §7.4 of the Design Guide, so a major version — while an API that expects every implementation to deliver events adds nothing and stays as it is (camaraproject/QualityOnDemand#556 tracks that decision for QoD). Worth saying so in §2.1, so the new text isn't read as requiring the error in every API offering the pattern.
Co-authored-by: Herbert Damker <herbert.damker@telekom.de>
…uide.md Co-authored-by: Herbert Damker <herbert.damker@telekom.de>
Co-authored-by: Herbert Damker <herbert.damker@telekom.de>
…uide.md Co-authored-by: Herbert Damker <herbert.damker@telekom.de>
Hi @hdamker, please take a look to the updates |
hdamker
left a comment
There was a problem hiding this comment.
Thanks for the updates, the suggestions are all in. Four small ones below, plus one point that is not code.
GENERIC_422_EVENT_NOTIFICATIONS_NOT_SUPPORTED is the only example in CreateResourceUnprocessableEntity422 defined inline; the other five reference the shared examples. Under the consumption model introduced by #665 (define the response locally, reference the shared examples) the new example would be added to components/examples in CAMARA_event_common.yaml and referenced from here, as GENERIC_422_PRIVATE_KEY_JWT_NOT_CONFIGURED is. That also gives APIs adopting the implicit subscription pattern something to reference instead of copying the example. The intro comment of the 422 block in that section is scoped to subscription creation today, so it would need to cover the implicit model as well.
…uide.md Co-authored-by: Herbert Damker <herbert.damker@telekom.de>
…uide.md Co-authored-by: Herbert Damker <herbert.damker@telekom.de>
Co-authored-by: Herbert Damker <herbert.damker@telekom.de>
Co-authored-by: Herbert Damker <herbert.damker@telekom.de>
rartych
left a comment
There was a problem hiding this comment.
LGTM
Thank you @PedroDiez
|
@eric-murray, please can you review this PR? |
What type of PR is this?
What this PR does / why we need it:
Formalises the behaviour for
sinkhandling in the implicit-subscription model: when a consumer provides a sink in the request, the API provider must either deliver events or reject the request with an error — silently creating the resource without notifications is no longer permitted.Changes
documentation/CAMARA-API-Event-Subscription-and-Notification-Guide.mdsinkis provided.422 EVENT_NOTIFICATIONS_NOT_SUPPORTEDand the resource MUST NOT be created.sink(e.g. fall back to polling).artifacts/common/CAMARA_event_common.yamlGENERIC_422_EVENT_NOTIFICATIONS_NOT_SUPPORTEDartifacts/api-templates/sample-implicit-events.yamlPOST /resourcesdescription to document the422 EVENT_NOTIFICATIONS_NOT_SUPPORTEDerror path.CreateResource.sinkdescription to clarify that omittingsinkskips notifications, and when an API provider doesn't support notification delivery at all whensinkis signalled within the request, an error is returned and resource is not created.Resource.sinkdescription to reflect thatsinkis echoed only when delivery is accepted and active.EVENT_NOTIFICATIONS_NOT_SUPPORTEDto the 422 response enum and added a corresponding example (referenced to new addedCAMARA_Event_common.yamlexample aforementioned) with an actionable error messageartifacts/testing/sample-implicit-events-template.featureWhich issue(s) this PR fixes:
Fixes #628
Does this PR introduce a breaking change?
Yes
No
Not clear behaviour so far so both allowing the resorce creation without notifications delivery as well as generating an error would be acceptable
NOTE: Today an implementation may accept sink, create the resource, and simply not send events; nothing forbids it. After this PR that is no longer allowed. Whether to document the new 422 is then each API's own decision: an API that wants to allow implementations without notification delivery adds it — a breaking change per §7.4 of the Design Guide, so a major version — while an API that expects every implementation to deliver events adds nothing and stays as it is.(camaraproject/QualityOnDemand#556 tracks that decision for QoD).
422 EVENT_NOTIFICATIONS_NOT_SUPPORTED, so backwards compatibility is not keptSpecial notes for reviewers:
Changelog input
Additional documentation
This section can be blank.